package me.xuym.crawler.house58statistics;

import com.cbs.java.component.application.Application;
import com.cbs.java.component.application.BaseArgs;
import me.xuym.crawler.Task;
import me.xuym.crawler.simpleextension.dispatcher.SimpleEmailDispatcher;

/**
 * Created by broche on 07/09/2017.
 */
public class MyApplication extends Application {
    private BaseArgs baseArgs = new BaseArgs();

    public MyApplication(String[] args) {
        super(args);
    }

    @Override
    public boolean isDebug() {
        return false;
    }

    @Override
    public String applicationName() {
        return "crawler/house58statistics";
    }

    @Override
    public BaseArgs getArgs() {
        return baseArgs;
    }

    @Override
    public void start() {
        super.start();

        try {
            Task task1 = new Task(this);
            task1.load(new House58DeltaAddressLoader(this)).dispatch(new House58DeltaAddressDispatcher(this));

            Task task2 = new Task(this);
            task2.load(new House58StatisticsLoader(this)).dispatch(new SimpleEmailDispatcher(this));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public static void main(String[] args) {
        MyApplication application = new MyApplication(args);
        application.start();
    }
}
